﻿/// <summary>
/// Developer: CHOOI KAH WAI
/// Last Modified: 11/10/2009
/// </summary>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ARSS.Components;

namespace ARSS.Components
{
    /// <summary>
    /// Base class for camera plugin.
    /// </summary>
    public class CamCom
    {
        #region Variables

        /// <summary>
        /// Index of selected camera device
        /// </summary>
        protected int selectedIndex;

        /// <summary>
        /// Video information
        /// </summary>
        protected CamVideoInfo camVideoInfo;

        #endregion

        #region Delegates / Events

        /// <summary>
        /// Camera video updates
        /// </summary>
        public virtual event Coordinator.CameraUpdateHandler CameraUpdateEvent;

        #endregion

        #region Functions

        /// <summary>
        /// Constructor
        /// </summary>
        public CamCom()
        {
            this.camVideoInfo = new CamVideoInfo();
        }

        /// <summary>
        /// Get list of camera devices
        /// </summary>
        /// <returns>Camera devices' name</returns>
        public virtual string[] GetCamNames()
        {
            string[] ss = new string[1];
            ss[0] = "Empty";
            return ss;
        }

        /// <summary>
        /// Initialization
        /// </summary>
        /// <param name="screenWidth">Display screen width</param>
        /// <param name="screenHeight">Display screen height</param>
        /// <param name="frameRate">Framerate</param>
        public virtual void Init(int screenWidth, int screenHeight, int frameRate)
        {
            this.camVideoInfo.Bits = 0;
            this.camVideoInfo.Height = 0;
            this.camVideoInfo.Stride = 0;
            this.camVideoInfo.Width = 0;
            this.camVideoInfo.VideoPixelFormat = System.Drawing.Imaging.PixelFormat.DontCare;
        }

        /// <summary>
        /// Retrieve video information
        /// </summary>
        /// <returns>Video Information</returns>
        public CamVideoInfo GetCamVideoInfo()
        {
            return this.camVideoInfo;
        }

        /// <summary>
        /// Select camera device
        /// </summary>
        /// <param name="_sel">Camera selection</param>
        public virtual void SetSelectedIndex(int selection)
        {
            this.selectedIndex = selection;
        }

        /// <summary>
        /// Start capture video
        /// </summary>
        public virtual void StartCapture() { }

        /// <summary>
        /// Stop capture video
        /// </summary>
        public virtual void StopCapture() { }

        #endregion
    }
}
